#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>

#include "DynamicLibCache.hh"

#include <map>


/*
class DyHandle{
	void * dl_ptr;
	int version;
	int status;
	std::string memo;
};

class DynamicLibCache{
	private:
		std::string dldir;//the direcotry of dynamic library
	protected:
		map<std::string ,DyHandle >   dlcache;
	public:
		DynamicLibCache(const char * str);
		bool addSo(const char * libname ,int version);
		bool addSo(const cahr * libfullname);

};
*/


DynamicLibCache::DynamicLibCache(const char * dir){

}

bool DynamicLibCache::addSo(const char * libfullname){
	void * handle=NULL;
	char dir[256]="";
	sprintf(dir,"%s/%s",dldir,libfullname);
	handle=dlopen(dir,RTLD_NOW);
	if(handle==NULL){
		return false;
	}

	return true;
}

bool DynamicLibCache::addSo(const char * libname,int version){
	char dir[256]="";
	sprintf(dir,"%s.%d",libname,version);
	return addSo(dir);
}
